/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.model.femModel.elementNode;

import java.util.HashMap;

import br.ufmg.dees.insane.model.femModel.node.Node;
import br.ufmg.dees.insane.util.IPoint3d;
import br.ufmg.dees.insane.util.pointValues.PointValues;

/**
 * A class representing a element node.
 * @author  Camara, Luciana & Pitangueira, Roque
 * @version  1.0
 * @since  May 2005
 */

public class ElementNode extends Node implements java.io.Serializable {
	
	private static final long serialVersionUID = 1L;

	/** The label of this Node. */
	protected Node node;
	
	/** The values of this Node. */
	protected HashMap elementNodeValues;
	
	/** The possible keys for the Map. */
	public static final String LINE_DUAL_VARIABLE = "LINE_DUAL_VARIABLE";
	public static final String SURFACE_DUAL_VARIABLE = "SURFACE_DUAL_VARIABLE";
	public static final String VOLUME_DUAL_VARIABLE = "VOLUME_DUAL_VARIABLE";

	public static final String LIBERATIONS = "LIBERATIONS";
	public static final String ELM_PRE_DISPLACEMENTS = "ELM_PRE_DISPLACEMENTS";
	public static final String INITIAL_EQ_NODAL_FORCE = "INITIAL_EQ_NODAL_FORCE";
	
	/**Constructs a ElementNode and sets its Node and initalize the values map.
     * @param n The node of this ElementNode.
     */
    public ElementNode(Node n) {
        super();
        this.elementNodeValues = new HashMap(3);
        this.node = n;
    }
    
    public ElementNode() {
        this.elementNodeValues = new HashMap(3);
    }
	
	/**
	 * Returns the node of this Node.
	 * @return  The node of this Node.
	 * @uml.property  name="node"
	 */
	public Node getNode(){
		return (node);
	};
	
	/**
	 * Sets the node of this Node.
	 * @param a  The node of this Node.
	 * @uml.property  name="node"
	 */
	public void setNode(Node a){
		node = a;
	};
	
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#cleanResults()
     */
    public void cleanResults() {
        this.getNode().cleanResults();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#getAngle()
     */
    public double getAngle() {
        return this.getNode().getAngle();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.util.IPoint3d#getCoords()
     */
    public double[] getCoords() {
        return this.getNode().getCoords();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#getLabel()
     */
    public String getLabel() {
        return this.getNode().getLabel();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#getNodeValues(java.lang.String)
     */
    public PointValues getNodeValues(String key) {
        return this.getNode().getNodeValues(key);
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#getPoint()
     */
    public IPoint3d getPoint() {
        return this.getNode().getPoint();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.util.IPoint3d#getX()
     */
    public double getX() {
        return this.getNode().getX();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.util.IPoint3d#getY()
     */
    public double getY() {
        return this.getNode().getY();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.util.IPoint3d#getZ()
     */
    public double getZ() {
        return this.getNode().getZ();
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#nodeValuesContainsKey(java.lang.String)
     */
    public boolean nodeValuesContainsKey(String key) {
        return this.getNode().nodeValuesContainsKey(key);
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#setAngle(double)
     */
    public void setAngle(double a) {
        this.getNode().setAngle(a);
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#setLabel(java.lang.String)
     */
    public void setLabel(String a) {
        this.getNode().setLabel(a);
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#setNodeValues(java.lang.String, br.ufmg.dees.insane.util.PointValues)
     */
    public void setNodeValues(String key, PointValues pv) {
        this.getNode().setNodeValues(key, pv);
    }
    /* (non-Javadoc)
     * @see br.ufmg.dees.insane.model.femModel.node.Node#setPoint(br.ufmg.dees.insane.util.IPoint3d)
     */
    public void setPoint(IPoint3d a) {
        this.getNode().setPoint(a);
    }

	/**
	 * The method return the elementNodeValues.
	 * @return  Returns The elementNodeValues.
	 * @uml.property  name="elementNodeValues"
	 */
	public HashMap getElementNodeValues() {
		return elementNodeValues;
	}

	/**
	 * The method set the field elementNodeValues from the parameter elementNodeValues.
	 * @param elementNodeValues  The elementNodeValues to set.
	 * @uml.property  name="elementNodeValues"
	 */
	public void setElementNodeValues(HashMap elementNodeValues) {
		this.elementNodeValues = elementNodeValues;
	}
	
	/** Returns true if it has the point values for the key.
	 * @param key The key of the point values.
	 * @return True if it has the point values for the key.
	 */
	public boolean elementNodeValuesContainsKey(String key) {
		return elementNodeValues.containsKey(key);
    }
	
	/** Returns the ElementNode point values.
	 * @param key The key of the point values.
	 * @return The node point values.
	 */
	  public PointValues getElementNodeValues(String key) {
	      return (PointValues)elementNodeValues.get(key);
	  }
	  
}
